package com.demo.core.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.demo.base.model.Upfiles;
import com.demo.core.dao.UploadDao;

@Transactional
@Service
public class UploadService {

	@Autowired
	UploadDao uploadDao;

	/**
	 * 新增文件
	 * @param upfiles
	 * @return
	 */
	public void addUpfiles(Upfiles upfiles) {
		
		uploadDao.add(upfiles);
		
	}
	
	/**
	 * 删除文件
	 * @param upfiles
	 */
	public void deleteUpfiles(Upfiles upfiles){
		
		uploadDao.delete(upfiles);
	}
	
	/**
	 * 修改文件信息
	 * @param upfiles
	 */
	public void updateUpfiles(Upfiles upfiles){
	
		uploadDao.update(upfiles);
	}
	
	/**
	 * 根据ID获取文件信息
	 * @param id
	 * @return
	 */
	public Upfiles getUpfiles(String id){
		
		return (Upfiles) uploadDao.get(Upfiles.class, id);
	}
}
